package org.example.websockettest.dao;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

import java.util.Set;

// 用户模型
@Getter
@Entity
public class User {
    // Getters and Setters
    @Setter
    @Id
    private Long userId;

    // 用户名唯一
    @Setter
    @Column(unique = true)
    private String username;

    @Setter
    private String password; // 添加密码字段

    @Setter
    private boolean isOnline; // 添加在线状态字段

    @Setter
    private String email; // 添加邮箱字段

    @Setter
    private String avatar; // 添加头像字段

    @Setter
    private String bio; // 添加个人简介字段

    @Setter
    private String className; // 添加班级字段

    @Setter
    private String school; // 添加学校字段

    @Setter
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "chat_room_id")
    private ChatRoom chatRoom;

    @OneToMany(mappedBy = "requester", fetch = FetchType.LAZY)
    private Set<Friendship> sentRequests;  // 用户发起的好友请求

    @OneToMany(mappedBy = "receiver", fetch = FetchType.LAZY)
    private Set<Friendship> receivedRequests;  // 用户收到的好友请求

    public User() {
    }
}
